import 'package:common/base/base_present.dart';
import 'package:common/constant/constant.dart';
import 'package:common/constant/http_constant.dart';
import 'package:common/network/code_msg_data_model.dart';
import 'package:common/network/dio_manager.dart';
import 'package:common/utils/aes_util.dart';
import 'package:user/mvp/model/login_request_model.dart';

import 'login_api_path.dart';

class LoginPresent extends BasePresent{

  LoginPresent(super.businessResponse);

  ///登录接口
  void login(String userName, String pwd){
    String encryptUserName = AesUtil.aesEncrypt(userName);
    String encryptPwd = AesUtil.aesEncrypt(pwd);
    LoginRequestModel requestModel = LoginRequestModel(phone: encryptUserName, code: encryptPwd, type: Constant.one);
    CodeMsgDataModel model = CodeMsgDataModel();
    model.code = Constant.one.toString();
    model.msg = '';
    model.data = requestModel.toMap();
    DioManager.external(HttpConstant.otherUrl).httpPostByPath(LoginApiPath.loginPath, codeMsgDataModelToJson(model),businessResponse);
  }

}